<?php

namespace model;

class article
{
    //搜索列表
    public static function searchJoinData()
    {
        $db = \libs\db::Init();
        $page = ['num' => 20, 'p' => $_GET['p'], 'return' => ['prev', 'next', 'first', 'last', 'list']];
        $field = 'b.id as cateid , b.name as catename ,a.id,a.cid,a.title,a.status,a.time';
        $where['a.title LIKE'] = '%' . VarFilter($_GET['keywords']) . '%';
        $join = 'LEFT JOIN article_cate b ON a.cid=b.id';
        return [
            'data' => $db->table('article a')->field($field)->Join($join)->page($page)->where($where)->order('a.id DESC')->select(),
            'page' => $db->getPage()
        ];
    }
}
